import backend

class PYMKException(Exception):
    pass

class PresetFileException(PYMKException):
    pass

VERBOSE = False

def options2settings(options):
    charset = getattr(backend, options.charset.upper() + "_CHARSET", None)
    if charset is None:
        raise PYMKException("Unknown charset %r" % options.charset)
    
    
    return backend.GeneratorSettings(modifier = options.modifier,
                                     age = options.age,
                                     length = options.length,
                                     charset = charset,
                                     hashName = options.hash_name)
